﻿if exists (select 1
            from  sysobjects
           where  id = object_id('t_customer')
            and   type = 'U')
   drop table t_customer
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_group')
            and   type = 'U')
   drop table t_group
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_grouplevel')
            and   type = 'U')
   drop table t_grouplevel
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_levelone_userid')
            and   type = 'U')
   drop table t_levelone_userid
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_levelthree_userid')
            and   type = 'U')
   drop table t_levelthree_userid
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_leveltwo_userid')
            and   type = 'U')
   drop table t_leveltwo_userid
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_levelzero_userid')
            and   type = 'U')
   drop table t_levelzero_userid
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_menu')
            and   type = 'U')
   drop table t_menu
go

if exists (select 1
            from  sysobjects
           where  id = object_id('t_sysuser')
            and   type = 'U')
   drop table t_sysuser
go

/*==============================================================*/
/* Table: t_customer                                            */
/*==============================================================*/
create table t_customer (
   cus_id               varchar(20)          not null,
   password             nvarchar(50)         null,
   passwordanswer       nvarchar(50)         null,
   passwordquestion     nvarchar(50)         null,
   cus_name             nvarchar(30)         null,
   cus_address          nvarchar(50)         null,
   cus_tel              nvarchar(30)         null,
   cus_linkman          nvarchar(10)         null,
   cus_account          nvarchar(30)         null,
   provincecode         varchar(6)           null,
   citycode             varchar(6)           null,
   countrycode          varchar(6)           null,
   areacode             varchar(6)           null,
   level_one_userid     nvarchar(20)         null,
   level_two_userid     nvarchar(20)         null,
   createdate           datetime             null default getdate(),
   canceldate           datetime             null,
   useflag              int                  null default 1,
   constraint PK_T_CUSTOMER primary key (cus_id)
         on "PRIMARY"
)
on "PRIMARY"
go

/*==============================================================*/
/* Table: t_group                                               */
/*==============================================================*/
create table t_group (
   groupid              int                  identity(1, 1),
   groupname            nvarchar(50)         null,
   adminflag            int                  null,
   levelid              varchar(32)          not null,
   constraint PK_T_GROUP primary key (groupid)
)
on "PRIMARY"
go

/*==============================================================*/
/* Table: t_grouplevel                                          */
/*==============================================================*/
create table t_grouplevel (
   levelid              varchar(32)          not null,
   levelname            nvarchar(10)         null,
   levelformat          varchar(20)          null,
   flevel               int                  null,
   constraint PK_T_GROUPLEVEL primary key (levelid)
)
go

/*==============================================================*/
/* Table: t_levelone_userid                                     */
/*==============================================================*/
create table t_levelone_userid (
   id                   int                  identity,
   constraint PK_T_LEVELONE_USERID primary key (id)
)
go

/*==============================================================*/
/* Table: t_levelthree_userid                                   */
/*==============================================================*/
create table t_levelthree_userid (
   id                   int                  identity,
   constraint PK_T_LEVELTHREE_USERID primary key (id)
)
go

/*==============================================================*/
/* Table: t_leveltwo_userid                                     */
/*==============================================================*/
create table t_leveltwo_userid (
   id                   int                  identity,
   constraint PK_T_LEVELTWO_USERID primary key (id)
)
go

/*==============================================================*/
/* Table: t_levelzero_userid                                    */
/*==============================================================*/
create table t_levelzero_userid (
   id                   int                  identity,
   constraint PK_T_LEVELZERO_USERID primary key (id)
)
go

/*==============================================================*/
/* Table: t_menu                                                */
/*==============================================================*/
create table t_menu (
   menuid               varchar(50)          not null,
   menucaption          nvarchar(50)         null,
   menuurl              nvarchar(100)        null,
   parentmenuid         varchar(50)          null,
   menuorder            int                  null,
   menuactive           int                  null,
   constraint PK_T_MENU primary key (menuid)
)
on "PRIMARY"
go

/*==============================================================*/
/* Table: t_sysuser                                             */
/*==============================================================*/
create table t_sysuser (
   userid               nvarchar(20)         collate Chinese_PRC_CI_AS not null,
   username             nvarchar(50)         collate Chinese_PRC_CI_AS null,
   usergroupid          int                  null,
   password             varchar(30)          collate Chinese_PRC_CI_AS null,
   account              nvarchar(30)         null,
   tele                 nvarchar(20)         null,
   address              nvarchar(60)         null,
   UseFlag              int                  null,
   FLevel               int                  null,
   qq                   nvarchar(30)         null,
   provincecode         varchar(6)           null,
   citycode             varchar(6)           null,
   countrycode          varchar(6)           null,
   createdate           datetime             null default getdate(),
   canceldate           datetime             null,
   parentuser           nvarchar(20)         null,
   constraint PK_T_SYSUSER primary key (userid)
)
on "PRIMARY"
go



delete from [t_grouplevel] 
go
delete from [t_group] 
go
delete from [t_sysuser] 
go

/* Data for the `t_grouplevel` table  (Records 1 - 4) */


INSERT INTO [t_grouplevel] ([levelid], [levelname], [levelformat], [flevel])
VALUES (N'0', N'系统管理员级', N'admin', 0)
GO

INSERT INTO [t_grouplevel] ([levelid], [levelname], [levelformat], [flevel])
VALUES (N'1', N'业务主管级别', N'', 1)
GO

INSERT INTO [t_grouplevel] ([levelid], [levelname], [levelformat], [flevel])
VALUES (N'2', N'二级业务员', N'', 2)
GO

INSERT INTO [t_grouplevel] ([levelid], [levelname], [levelformat], [flevel])
VALUES (N'3', N'宣传员组', N'xcy', 3)
GO





/* Data for the `t_group` table  (Records 1 - 4) */
set identity_insert t_group on
go

INSERT INTO [t_group] ([groupid], [groupname], [adminflag], [levelid])
VALUES (2, N'超级管理员组', 1, N'0')
GO

INSERT INTO [t_group] ([groupid], [groupname], [adminflag], [levelid])
VALUES (3, N'宣传员', 0, N'3')
GO

INSERT INTO [t_group] ([groupid], [groupname], [adminflag], [levelid])
VALUES (4, N'业务主管级别', 0, N'1')
GO

INSERT INTO [t_group] ([groupid], [groupname], [adminflag], [levelid])
VALUES (5, N'二级业务员组', 0, N'2')
GO

set identity_insert t_group on
go


/* Data for the `t_sysuser` table  (Records 1 - 1) */


INSERT INTO [t_sysuser] ([userid], [username], [usergroupid], [password], [account], [tele], [address], [UseFlag], 

[FLevel], [qq], [provincecode], [citycode], [countrycode], [createdate], [canceldate])
VALUES (N'admin', N'admin', 2, N'1', NULL, NULL, NULL, 1, 0, NULL, NULL, NULL, NULL, '20091106 08:21:10.217', NULL)
GO





/* Data for the `t_menu` table  (Records 1 - 26) */


INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'1', N'系统管理', N'', N'', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'1-2', N'菜单维护', N'/popedom/menuManage/menuList.aspx', N'1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'1-3', N'组授权', N'/popedom/groupPermit/groupmenu.aspx', N'1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'19e2e5b412ea4fa3b5ffe2c5006f53d0', N'管理员组维护', N'/popedom/usermanage/userzerolist.aspx', N'27f634b999c342bf8900b450b879ce4e', NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'25ceefbcd8324adc9719e79e47a79736', N'网站系统管理', N'', N'', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'27f634b999c342bf8900b450b879ce4e', N'用户维护', N'', N'1', NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'28d9d38aaf9a4bbf8e8885dde706f541', N'更改密码', N'/popedom/Login/updpassword.aspx', N'1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'34d84576e2224240ae91d864a4150014', N'未确认付款订单查询(按照下订单排序)', N'/systemanage/order/orderlist.aspx?type=5', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'37216507ed934b48aacd42ac7c7b8193', N'销售清单查询(根据产品大类)', N'/systemanage/order/orderlist.aspx?type=6', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'3fcf472fd22549a3a011ae748149b593', N'业务员组维护', N'/popedom/usermanage/userthreelist.aspx', N'27f634b999c342bf8900b450b879ce4e', NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'43dd00af81674c3998bec3e2a6906c67', N'地级市级组维护', N'/popedom/usermanage/usertwolist.aspx', N'27f634b999c342bf8900b450b879ce4e', NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'50f64c6d20614cf49ce659da1bc7e6c7', N'当日销售清单查询(按照销售顺序排序)', N'/systemanage/order/orderlist.aspx?type=3', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'69e3bfa2e4454d269bc63e61ec4a753d', N'产品类别维护', N'/systemanage/productclass/navigator.aspx', N'f27b25247e2b42b1a09409a9fffd6d12', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'818132999a64445c88d4e57e46cbb83a', N'组维护', N'/popedom/groupManage/grouplist.aspx', N'1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'8b906cfd99ba4a6392a4a11972862bf1', N'订单管理', N'', N'', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'8f44955bb86b4daf8746b2495fe7dcc9', N'网站信息维护', N'/systemanage/info/info.aspx', N'25ceefbcd8324adc9719e79e47a79736', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'92a4ae03caae4aed91366539c9a01165', N'销售订单查询(综合)', N'/systemanage/order/orderlistall.aspx', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'a02c0aa1c2d94a63852f6d7acf29ba94', N'当日销售清单查询(按照次数排序)', N'/systemanage/order/orderlist.aspx?type=4', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'a6a71901265743f892d6bb4f31a7e80f', N'产品信息维护', N'/systemanage/product/navigator.aspx', N'bfe65c589d754ee1b58d552cbb71c8c8', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'aed5947f1c4c4349beb2cc41d43fa795', N'网站明细信息管理', N'/systemanage/info/infodtl.aspx', N'25ceefbcd8324adc9719e79e47a79736', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'bfe65c589d754ee1b58d552cbb71c8c8', N'产品管理', N'', N'', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'd10ca729af3844859269b61dfca22bd4', N'业务主管组维护', N'/popedom/usermanage/useronelist.aspx', N'27f634b999c342bf8900b450b879ce4e', NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'd995bab24e8c497593e984aef600e48f', N'供应商信息维护', N'/systemanage/customer/mainpage.aspx', NULL, NULL, NULL)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'e3a605ffbc3b452c8eb3eb8e23b25f15', N'销售清单查询(根据销售商手机号码)', N'/systemanage/order/orderlist.aspx?type=2', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'f27b25247e2b42b1a09409a9fffd6d12', N'产品类别管理', N'', N'', 0, 0)
GO

INSERT INTO [t_menu] ([menuid], [menucaption], [menuurl], [parentmenuid], [menuorder], [menuactive])
VALUES (N'fbaa9a45ddb44e639e2f9b155cde0618', N'销售清单查询(根据循环滚动器序号)', N'/systemanage/order/orderlist.aspx?type=1', N'8b906cfd99ba4a6392a4a11972862bf1', 0, 0)
GO


